import { get, post } from '@/utils/request.ts'
import type { TodoAddDTO, TodoUpdateDTO } from '@/interface'

/**
 * 获取所有列表
 */
export const queryTodoList = (params: { createdBy: number }) => {
  return get(`/backlog/query`, params)
}

/**
 * 新增待办
 */
export const addTodo = (params: TodoAddDTO) => {
  return post(`/backlog/insert`, params)
}

/**
 * 更新待办
 */
export const updateTodo = (params: TodoUpdateDTO) => {
  return post(`/backlog/insert`, params)
}

/**
 * 完成待办
 */
export const completeTodo = (params: { id: number }) => {
  return post(`/backlog/complete`, params)
}

/**
 * 删除待办
 */
export const deleteTodo = (id: number) => {
  return get(`/backlog/remove/${id}`)
}

/**
 * 待办事项完成占比
 */
export const queryAccomplish = (params: { createdBy: number }) => {
  return get(`/backlog/accomplish`, params)
}
